package com.wuhanins.insmytestdemo.base;

import android.os.Environment;

import java.io.File;

/**
 * Author  ： logan
 * Time    ： 10/12/21 3:08 PM
 * Desc    ： 项目静态资源
 */
public class Static {
    private final static String RootFolder = "InsTestDemo";
    private final static String RootPath = Environment.getExternalStorageDirectory().getPath() + File.separator + RootFolder;

    public static String getRootFolderPath() {
        return RootPath;
    }

    public final static String getCrashHandlerPath() {
        makeDir(RootPath);
        return RootPath + File.separator + "/crash";
    }

    public static String getDownloadApkPath(String apkName) {
        makeDir(RootPath);
        return RootPath + File.separator + apkName;
    }

    public static String getTempApkPath() {
        return RootPath + File.separator + "install.apk";

    }

    public static String getTempFilePath(String tempFileName) {
        makeDir(getTempFileDir());
        return getTempFileDir() + File.separator + tempFileName;
    }

    public static String getTempFileDir() {
        makeDir(RootPath);
        return RootPath + File.separator + "temp";
    }

    public static void makeDir(String path) {
        File file = new File(path);
        if (!file.exists()) {
            file.mkdir();
        }
    }
}
